package com.hua.yuan.live.view.anchor;

import android.annotation.SuppressLint;
import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

import com.hua.yuan.live.R;
import com.hua.yuan.live.adapter.LiveHistoryAdapter;
import com.hua.yuan.live.listener.OnBuyClickListener;
import com.hua.yuan.live.repertory.cloud_data.res.LiveHistoryComband;
import com.hua.yuan.live.repertory.cloud_data.res.LiveVideoBean;
import com.hua.yuan.live.repertory.cloud_data.res.RoomInfoBean;
import com.jet.flowtaglayout.FlowTagLayout;

import java.util.ArrayList;
import java.util.List;

import static android.view.View.GONE;

/**
 * 主播历史的view
 */
public class HistoryView {

    private ListView mLiveHistory;

    private LiveHistoryAdapter mAdapter;


    public HistoryView(Context pContext, View pView, OnBuyClickListener pListener){
        mLiveHistory=pView.findViewById(R.id.lsv_live_history);
        mAdapter=new LiveHistoryAdapter(pContext,pListener);
        mLiveHistory.setAdapter(mAdapter);
    }


    @SuppressLint("StringFormatMatches")
    public void setData(LiveHistoryComband data){

        if(data==null){
            return;
        }
        List<LiveVideoBean> mList=data.getLiveVideoBean();
        if(mList==null || mList.size()==0){
            return;
        }
        mAdapter.setData(mList);
        mAdapter.notifyDataSetChanged();
    }

    public void setVisible(int  isVisible){
        mLiveHistory.setVisibility(isVisible);
    }

    public List<LiveVideoBean> getData(){
        return mAdapter.getData();
    }
}
